<template>
  <div class="con">
    <el-container>
      <!-- <el-header style="padding:0;height: 56px;">
        <headbox ref="mychild"></headbox>
      </el-header>-->
      <el-container>
        <!-- <el-aside  style="width:200px;background-color:#393D49;">
          <left></left>
        </el-aside>-->
        <el-container>
          <el-main style="padding:0;">
            <!-- 放置内容区 -->
            <div class="contbox6_10">
              <!-- 机构列表 -->
              <p class="titlelist6_10">
                结算信息
                <span style="color: #999;">&nbsp;&nbsp;/&nbsp;&nbsp;</span
                >账户信息
              </p>
              <div class="content">
                <div
                  class="jibenInfo"
                >
                  结算账户
                </div>
                <!-- <el-form :model="ruleForm" label-position='left' :hide-required-asterisk='true' ref="ruleForm" label-width="100px" class="demo-ruleForm">
                  <p class="sizes">如需修改资料，请联系上级平台方</p>
                  <div class="left">
                    <p>支付宝</p>
                    <p>APPID：{{fromdata.appId}}</p>
                    <p>支付宝账户：{{fromdata.aliNo}}</p>
                    <p>联系人姓名：{{fromdata.aliName}}</p>
                    <p>电子邮箱：{{fromdata.aliEmail}}</p>
                    <p>手机号码：{{fromdata.aliPhone}}</p>
                  </div>
                  <div class="right">
                    <p>银行卡</p>
                    <p>账户类型：{{fromdata.accountType == 1 ? '对公' : '对私'}}</p>
                    <p>结算账户名：{{fromdata.accountName}}</p>
                    <p>结算账户：{{fromdata.accountNo}}</p>
                    <p>开户银行：{{fromdata.bankName}}</p>
                    <p>开户支行：{{fromdata.openBank}}</p>
                    <p>开户身份证号：{{fromdata.certNbr}}</p>
                    <p>银行预留手机号：{{fromdata.reservedMobile}}</p>
                  </div>
                </el-form>-->
                <el-row :gutter="20">
                  <el-col :span="7">
                    <div class="grid-content bg-purple">
                      <span class="title">支付宝</span>
                      <div class="zfb">
                        <div class="lt">
                          <img
                            src="../../assets/images/zfb.png"
                            class="zfbImg"
                            alt
                          />
                          <span>支付宝</span>
                        </div>
                        <div class="rt">收款账号</div>
                        <div class="both"></div>
                        <p class="center">{{ fromdata.aliNo }}</p>
                        <div style="margin-left:114px;margin-top:42px">
                          <el-button type="primary">入账记录</el-button>
                          <el-button type="" class="record"
                            >出账记录</el-button
                          >
                        </div>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="7">
                    <div class="grid-content bg-purple">
                      <span class="title">结算卡</span>
                      <div class="zfb">
                        <div class="lt">
                          <!-- <img src="../../assets/images/zfb.png" class="zfbImg" alt /> -->
                          <span>{{ fromdata.bankName }}</span>
                        </div>
                        <div class="rt">对公结算卡</div>
                        
                        <div class="both"></div>
                        <p class="center">{{ fromdata.accountNo }}</p>
                        <div style="margin-left:114px;margin-top:58px">
                          <el-button type="primary">充值记录</el-button>
                          <el-button type="primary" class="record"
                            >提现记录</el-button
                          >
                        </div>
                      </div>
                    </div>
                  </el-col>
                  <!-- <el-col
                    :span="7"
                    v-if="
                      fromdata.xmgjAccountNo == '' ||
                        fromdata.xmgjAccountNo == null
                    "
                  >
                    <div class="grid-content bg-purple">
                      <span class="title">厦门国际银行电子卡</span>
                      <div class @click="open">
                        <div class="zfb">

                          <span class="bankLet">厦门国际银行电子卡</span>
                          <div class="both"></div>
                          <p class="kh">立即开户</p>
                        </div>
                      </div>
                    </div>
                  </el-col> -->
 
                  <el-col :span="7" v-if="
                      fromdata.xmgjAccountNo
                    ">
                    <div class="grid-content bg-purple">
                      <span class="title">厦门国际银行电子卡</span>
                      <span class="titleMoney"
                        >账户余额：{{ fromdata.availAmt || 0 }}元</span
                      >
                      <div class="zfb">
                        <div class="lt">
                          <img
                            src="../../assets/images/xiamenBank.png"
                            class="zfbImg"
                            alt
                          />
                          <span>厦门国际银行</span>
                        </div>
                        <div class="rt">电子卡</div>
                        <div class="both"></div>
                        <p class="center">{{ fromdata.xmgjAccountNo }}</p>
                        <div style="margin-top:38px;margin-left:54px;">
                          <el-button type="primary" @click="modifyPhone()" v-if="false"
                            >修改手机号</el-button
                          >
                          <el-button
                            type="primary"
                            class="record"
                            @click="modificationCard()"
                            v-if="false"
                            >修改结算卡</el-button
                          >
                          <el-button
                            type="primary"
                            class="introduce"
                            @click="use()"
                            v-if="false"
                            >使用介绍</el-button
                          >
                        </div>
                      </div>
                    </div>
                  </el-col>
                </el-row>

                <div style="clear:both"></div>
                <el-divider></el-divider>
                <p class="information">结算成本</p>
                <p class="settlement">
                  <!-- <el-checkbox disabled v-model="fromdata.bill">是否提供发票</el-checkbox> -->
                  <span>银行卡支付手续费：{{ fromdata.payCost || 0 }}%</span>
                  <span
                    >银行卡代付手续费（单笔）：{{
                      fromdata.singleBehalfPayCost || 0
                    }}元</span
                  >
                  <span
                    >银行卡代付手续费（比例）：{{
                      fromdata.behalfPayCost || 0
                    }}%</span
                  >
                </p>

                <!-- <div style="clear:both"></div>
                <el-divider></el-divider>
                <p class="information">平台余额信息</p>
                <p class="balance">当前可用余额：{{fromdata.availAmt}}元</p>-->
              </div>
            </div>
          </el-main>
          <!-- <el-footer style="padding:0;">
            <footerbox></footerbox>
          </el-footer>-->
        </el-container>
      </el-container>
    </el-container>
    <div>
      <el-dialog
        title="厦门国际银行分账业务开通"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
      >
        <div class="banner">
          <img src="../../assets/images/banner.png" alt />
        </div>
        <div style="margin-left:10px">
          <p class="fztex">分账介绍</p>
          <p class="fzcont">
            开通此业务您可以享受厦门国际银行的分账业务
            此业务为您提供支付、分账、清算、对账等服务，系统为每个平台的权益用户建立客户信息以及预付货款登记分户和待清算登记分户，实现平台自有资金和权益用户资金完全分离
          </p>
          <p class="fztex">使用流程：</p>
          <p class="fzcont">
            1、开通：开通需要在系统完善信息并通过厦门银行完成开户
          </p>
          <p class="fzcont">
            2、充值：通过线下进行充值，充值金额将在您独立账户保留，下属APP通过银行卡提现时，将从您的账户直接扣款至代理商银行卡
          </p>
          <p class="fzcont">
            3、提现：可以通过提现入口发起提现，提现的金额将会到您的对公户
          </p>
          <p class="fzcont">
            4、资金流变更的收费情况可以在账户信息-成本信息中查询
          </p>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="isOk()">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import https from "../../plugins/https";
export default {
  name: "AdminSettlement",
  data() {
    return {
      fromdata: {},
      // checked: false,
      dialogVisible: false, //对话框
      // ruleForm: {
      //   treasureAccount: "",
      //   ContactName: "",
      //   email: "",
      //   tel: "",
      //   accountState: "",
      //   accountName: "",
      //   accountMoney: "",
      //   bank: "",
      //   branch: "",
      //   bankTel: "",
      //   cardID: "",
      // },
      alipayAccount: ""
      //   urltype: this.GLOBAL.httpurl,
    };
  },
  components: {},
  mounted: function() {
    this.show();
    // this.from();
  },
  methods: {
    // submitForm: function () {},
    // from: function () {
    //   let parme = {
    //     officeUid: localStorage.getItem("uid"),
    //   };
    //   https.getUpdateOfficeInfo(parme).then((res) => {
    //     if (res.data.code !== "0000")
    //       return this.$notify({
    //         title: "错误",
    //         message: res.data.msg,
    //         type: "error",
    //       });
    //     this.fromdata = res.data.data;
    //     this.fromdata.bill = this.fromdata.bill == 0 ? true : false;
    //   });
    // },

    open() {
      // 弹框显示
      this.dialogVisible = true;
    },
    handleClose(done) {
      done();
      // this.$confirm('确认关闭？')
      //   .then(_ => {
      //     done();
      //   })
      //   .catch(_ => {});
    },

    //进入页面回显
    show() {
      var _this = this;
      let parme = {
        officeUid: localStorage.getItem("uid")
      };
      https.getUpdateOfficeInfol(parme)
        .then(function(d) {
          if (d.data.code == "0000") {
            _this.fromdata = d.data.data;
          } else {
            layer.open({
              content: d.data.msg,
              skin: "msg",
              time:  2 //1秒后自动关闭
            });
          }
        })
        .catch(function(error) {
          //axios请求失败回调
          console.log(error);
        });
    },

    // 开卡弹框介绍
    isOk() {
      let _this = this;
      let uid = localStorage.getItem("uid");
      console.log(JSON.stringify(_this.fromdata) + "你好1111111111111111");
      this.$router.push({
        name: "addCard",
        params: {
          uid: uid,
          // 企业名称
          custName: _this.fromdata.custName,
          // 组织机构代码
          organizCode: _this.fromdata.organizCode,
          // 开户行
          bankCode: _this.fromdata.bankCode,
          // 企业对公账号
          accountNo: _this.fromdata.accountNo,
          //企业预留手机号
          principalPhone: _this.fromdata.principalPhone,
          // 法人姓名
          legalPersonName: _this.fromdata.legalPersonName,
          // 法人身份证号
          legalPersonIdCard: _this.fromdata.legalPersonIdCard,
          // 企业电子邮箱
          email: _this.fromdata.email,
          // 开户银行名
          bankName: _this.fromdata.bankName
        }
      });
    },
    // 使用介绍弹框
    use() {
      this.$alert(
        "电子卡是在厦门银行开立的电子账户卡片号码。 需要对此卡充值可以通过通过手机银行，通过您的同名对私账户借记卡向此卡片进行充值。如想进行提现，请通过平台来进行提现，提现金额到账至您绑定的对公户",
        "提示",
        {
          confirmButtonText: "确定"
          // callback: (action) => {
          //   this.$message({
          //     type: "info",
          //     message: "关闭成功",
          //   });
          // },
        }
      );
    },
    // 修改结算卡
    modificationCard() {
      // this.$router.push({name:'modifyCard'})
      this.$message("功能暂未开通，敬请期待！");
    },

    // 修改手机号
    modifyPhone() {
      var _this = this;
      let parme = {
        officeUid: localStorage.getItem("uid")
      };
      _this
        .axios({
          //axios请求
          method: "post",
          url: "/api/account/updateSprataPhone",
          data: parme
        })
        .then(function(d) {
          if (d.data.code == "0000") {
            window.open(d.data.data.retUrl);
          } else {
            layer.open({
              content: d.data.msg,
              skin: "msg",
              time:  2 //1秒后自动关闭
            });
          }
        })
        .catch(function(error) {
          //axios请求失败回调
          console.log(error);
        });
    }
  }
};
</script>

<style scoped>
.con {
  position: relative;
}
.content{
  min-width: calc(100% - 40px);
  padding: 0 20px;
}
.elBtn {
  margin-top: -40px;
  float: left;
  margin-left: 100px;
}
.left {
  width: 40%;
  float: left;
  /* padding-left: 70px; */
}
.balance {
  font-size: 14px;
  margin-top: 30px;
}
.settlement span {
  font-size: 14px;
  margin-left: 120px;
}
.left p,
.right p {
  font-size: 14px;
  line-height: 40px;
}
.right {
  width: 40%;
  border-left: 1px solid #999;
  float: left;
  padding-left: 80px;
}
.information {
  font-size: 15px;
  margin-top: 10px;
  margin-bottom: 10px;
  color: #999;
}
.sizes {
  font-size: 15px;
  margin-top: 60px;
  margin-bottom: 20px;
  color: #999;
}
/* 单独样式 */
.contbox6_10 {
  width: 100%;
  /*  height: 87.5vh; */
  overflow-x: auto;
  box-sizing: border-box;
  float: left;
}
.titlelist6_10 {
  width: 100%;
  /* float: left; */
  font-size: 16px;
  color: #222;
  /* margin-top: 40px; */
}
.zfb {
  margin: 30px 0;
  font-size: 16px;
  border-radius: 20px;
  /* border: 1px solid #999; */
  padding: 20px 0;
  background: #F5F7FA;
  height: 200px;
}
.lt {
  float: left;
  margin-left: 10px;
}
.rt {
  float: right;
  vertical-align: middle;
  margin-right: 10px;
  margin-top: 10px;
  display: inline-block;
}
/* .lt1 {
  float: left;
  margin-top: 10px;
  margin-left: 10px;
}
.rt1 {
  float: right;
  vertical-align: middle;
  margin-right: 10px;
  margin-top: 10px;
  display: inline-block;
} */
.zfbImg {
  width: 50px;
  height: auto;
  vertical-align: middle;
  border-radius: 10px;
}
.both {
  clear: both;
}
.center {
  text-align: center;
  height: 20px;
}

.record {
  background: #fff;
  color: #409eff;
  border: none;
}
.introduce {
  background: #ffcc40;
  border: none;
}
.title {
  font-size: 15px;
  color: #999;
}
.xm {
  margin: 30px 0;
  font-size: 16px;
  border-radius: 20px;
  border: 1px solid #999;
  padding: 20px 0;
  height: 140px;
}
.kh {
  cursor: pointer;
  text-align: center;
  padding: 40px 0;
  font-size: 20px;
  color: #409EFF;
}
.banner {
  width: 95%;
  height: auto;
  margin: 0 auto;
  border-bottom: 1px solid #999;
  padding: 10px 0;
}
.banner img {
  width: 100%;
  height: auto;
}
.fztex {
  font-size: 15px;
  color: #999;
  padding: 10px 0;
}
.fzcont {
  font-size: 14px;
  color: #999;
  padding: 10px 0;
}
.bankLet {
  margin-left: 10px;
  margin-top: 10px;
  display: inline-block;
}
.titleBank {
  font-size: 15px;
  color: #999;
}
.titleMoney {
  font-size: 15px;
  color: #999;
  display: inline-block;
  margin-left: 85px;
}
.cardLt {
  float: left;
  margin-top: 10px;
  margin-left: 10px;
}
.cardRt {
  float: right;
  vertical-align: middle;
  margin-right: 10px;
  margin-top: 10px;
  display: inline-block;
}
.center1 {
  padding: 20px 0;
  text-align: center;
}
.jibenInfo {
  width: 100%;
  margin: 20px 0;
  height: 40px;
  line-height: 40px;
  padding-left: 20px;
  background: #f9fafc;
  float: left;
}
.el-col-7{
  width:500px
}
</style>
